#include <bits/stdc++.h>
using namespace std;

set<vector<int> > s;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int T; cin >> T;
    while(T--){
        s.clear();
        int N; cin >> N;
            vector<int> now;
            for (int i = 0; i < N; ++i) {
                int t;
                cin >> t;
                now.push_back(t);
            }
            s.insert(now);
            vector<int> zero(N, 0);
            bool bzero = false, loop = false;
            while(true){
                vector<int> next;
                for (int i = 0; i < N-1; ++i) {
                    next.push_back(abs(now[i] - now[i+1]));
                }
                next.push_back(abs(now[N-1] - now[0]));

                if(next == zero){ bzero = true; break;}

                if(s.count(next)) {loop = true; break;}
            s.insert(next);
            now = next;
        }
        if(bzero) cout << "ZERO\n";
        if(loop) cout << "LOOP\n";
    }
    return 0;
}